package com.Common.ThreadPoolControl;

import java.util.concurrent.*;

/**
 * @Description:
 * @Author: suzr
 * @Date: 2019-5-10 15:18
 * @return:
 * @throws:
 */
public class ThreadPoolManager {

    private static class MyThreadFactory implements ThreadFactory {
        @Override
        public Thread newThread(Runnable r) {
            return new Thread(r);
        }
    }


    public static final ExecutorService executorService = new ThreadPoolExecutor
            (6, 20, 30, TimeUnit.SECONDS,
                    new LinkedBlockingQueue<>(50), new MyThreadFactory(), new ThreadPoolExecutor.AbortPolicy());

    //关闭线程池
    public static void closeThread() {
        executorService.shutdown();
    }
}
